<template>
    <div class="Box">
        <div class="info">
            <p>{{ props.title }}</p>
            <p class="desc">{{ props.summary }}</p>
            <div class="iconBox">
                <span>{{ props.category_name }}</span>        
                <p>
                    <img src="@/assets/up/look.png" alt="">
                    <span>{{ formatNum(props.stats.view) }}</span>
                </p>
                <p>
                    <img src="@/assets/up/dz.png" alt="">
                    <span>{{ formatNum(props.stats.like) }}</span>
                </p>
                <p>
                    <img src="@/assets/up/message.png" alt="">
                    <span>{{ formatNum(props.stats.reply) }}</span>
                </p>
                <p>
                    <img src="@/assets/up/time.png" alt="">
                    <span>{{ formatIsYMD(props.ctime) }}</span>
                </p>    
            </div>
        </div>
        <div class="imgbox">
            <img :src="props.banner_url">
        </div>
    </div> 
</template>

<script lang="ts" setup>
import { formatNum,formatIsYMD } from '@/utils/format'
interface Props{
    id:number
    title:string
    banner_url:string
    summary:string  //简介
    category_name:string //专栏类别
    ctime:number
    stats:{
        view:number
        like:number
        reply:number    //评论
    }
}
const props = defineProps<Props>()
</script>

<style lang="scss" scoped>
p{
    margin: 0;
    padding: 0;
}
.Box{
    @include flexRowCenter;
    height: 90px;
    gap: 20px;
}
.info{
    width: calc(85% - 20px);
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: start;
    gap: 15px 0;
    & p:nth-child(1){
        font-size: 18px;
    }
}
.desc{
    color: #6D757A;
    font-size: 12px;
    text-align: left;
    width: 100%;
    @include noWrap;
}
.iconBox{
    display: flex;
    justify-content: start;
    align-items: center;
    font-size: 12px;
    gap: 0 25px;
    color: #999999;
    & p{
        @include flexRowCenter;
        gap: 0 5px;
    }
    & p img:nth-child(1){
        width: 16px;
    }
}
.imgbox{
    width: 15%;
    height: 100%;
    & img:nth-child(1){
        width: 100%;
        height: 100%;
        object-fit: cover;
        border-radius: 4px;
    }
}
</style>